import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';

import {Observable} from "rxjs/Observable";
import 'rxjs/add/operator/map';

import {ClientMod} from '../../../model/pages/client/clients-add/clients-add.model';

@Injectable()
export class ClientAddProvider {

    constructor(public http: HttpClient) {
    }

    // 新增客户请求
    addNewCustomer(customerData: ClientMod): Observable<any> {

        return this.http.post(`/leads/v1/lead`, customerData, {responseType: "text"});

    }

    //验证电话和姓名
    checkCustomer(data): Observable<any> {
        return this.http.post(`/leads/v1/contact`, data, {responseType: "text"});

    }

    // 删除服务器地址电话号码
    delPhoneAddAdd(id): Observable<any> {
        return this.http.delete(`/leads/v1/contact/${id}`, {responseType: "text"});
        //    return this.http.delete(`http://10.248.37.62:8065/leads/v1/contact/${id}`,{responseType:"text"});
    }
}
